import 'package:flutter/painting.dart';
import 'package:pp_uikit/theme/pp_default_theme.dart';

class PPTabBarTheme {
  PPTabBarTheme({
    double? tabHeight,
    double? indicatorHeight,
    double? indicatorWidth,
    TextStyle? labelStyle,
    TextStyle? unselectedLabelStyle,
    Color? backgroundColor,
    TextStyle? tagNormalTextStyle,
    Color? tagNormalBgColor,
    TextStyle? tagSelectedTextStyle,
    Color? tagSelectedBgColor,
    double? tagRadius,
    double? tagSpacing,
    int? preLineTagCount,
    double? tagHeight,
  })  : _tabHeight = tabHeight,
        _indicatorHeight = indicatorHeight,
        _indicatorWidth = indicatorWidth,
        _labelStyle = labelStyle,
        _unselectedLabelStyle = unselectedLabelStyle,
        _backgroundColor = backgroundColor,
        _tagNormalTextStyle = tagNormalTextStyle,
        _tagNormalBgColor = tagNormalBgColor,
        _tagSelectedTextStyle = tagSelectedTextStyle,
        _tagSelectedBgColor = tagSelectedBgColor,
        _tagRadius = tagRadius,
        _tagSpacing = tagSpacing,
        _preLineTagCount = preLineTagCount,
        _tagHeight = tagHeight,
        super();

  /// TabBar 的整体高度
  /// 默认为 50
  final double? _tabHeight;

  /// 指示器的高度
  /// 默认为 2
  final double? _indicatorHeight;

  /// 指示器的宽度
  /// 默认为 24
  final double? _indicatorWidth;

  /// 选中 Tab 文本的样式
  final TextStyle? _labelStyle;

  /// 未选中 Tab 文本的样式
  final TextStyle? _unselectedLabelStyle;

  /// 背景色
  final Color? _backgroundColor;

  /// 标签字体样式
  final TextStyle? _tagNormalTextStyle;

  /// 标签背景色
  final Color? _tagNormalBgColor;

  /// 标签字体样式
  TextStyle? _tagSelectedTextStyle;

  /// 标签选中背景色
  Color? _tagSelectedBgColor;

  /// tag圆角
  double? _tagRadius;

  /// tag间距
  /// 默认为 12
  double? _tagSpacing;

  /// 每行的tag数
  /// 默认为 4
  int? _preLineTagCount;

  /// tag高度
  /// 默认为 32
  double? _tagHeight;

  double get tabHeight =>
      _tabHeight ?? PPDefaultTheme.defaultTabBarConfig.tabHeight;

  double get indicatorHeight =>
      _indicatorHeight ?? PPDefaultTheme.defaultTabBarConfig.indicatorHeight;

  double get indicatorWidth =>
      _indicatorWidth ?? PPDefaultTheme.defaultTabBarConfig.indicatorWidth;

  TextStyle get labelStyle =>
      _labelStyle ?? PPDefaultTheme.defaultTabBarConfig.labelStyle;

  TextStyle get unselectedLabelStyle =>
      _unselectedLabelStyle ??
      PPDefaultTheme.defaultTabBarConfig.unselectedLabelStyle;

  Color get backgroundColor =>
      _backgroundColor ?? PPDefaultTheme.defaultTabBarConfig.backgroundColor;

  TextStyle get tagNormalTextStyle =>
      _tagNormalTextStyle ??
      PPDefaultTheme.defaultTabBarConfig.tagNormalTextStyle;

  Color get tagNormalBgColor =>
      _tagNormalBgColor ?? PPDefaultTheme.defaultTabBarConfig.tagNormalBgColor;

  TextStyle get tagSelectedTextStyle =>
      _tagSelectedTextStyle ??
      PPDefaultTheme.defaultTabBarConfig.tagSelectedTextStyle;

  Color get tagSelectedBgColor =>
      _tagSelectedBgColor ??
      PPDefaultTheme.defaultTabBarConfig.tagSelectedBgColor;

  double get tagRadius =>
      _tagRadius ?? PPDefaultTheme.defaultTabBarConfig.tagRadius;

  double get tagSpacing =>
      _tagSpacing ?? PPDefaultTheme.defaultTabBarConfig.tagSpacing;

  int get preLineTagCount =>
      _preLineTagCount ?? PPDefaultTheme.defaultTabBarConfig.preLineTagCount;

  double get tagHeight =>
      _tagHeight ?? PPDefaultTheme.defaultTabBarConfig.tagHeight;
}
